{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Lecture 13 - Advanced Curve Fitting: Gaussian Processes to Encode Prior Knowledge about Functions"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "%matplotlib inline\n",
    "import seaborn as sns\n",
    "sns.set_context('talk')\n",
    "sns.set_style('white')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Objectives\n",
    "\n",
    "+ Express prior knowledge/beliefs about unknown functions using Gaussian process (GP).\n",
    "\n",
    "+ Sample functions from the probability measure defined by GP."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "## Readings\n",
    "\n",
    "+ [Chapter 1 from C.E. Rasmussen's textbook on Gaussian processes](http://www.gaussianprocess.org/gpml/chapters/RW1.pdf).\n",
    "\n",
    "+ (Optional video lecture) [Neil Lawrence's video lecture on Introduction to Gaussian processes](https://www.youtube.com/watch?v=ewJ3AxKclOg)."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Motivation: A fully Bayesian paradigm for curve fitting\n",
    "\n",
    "Gaussian process regression is Bayesian regression on steroids.\n",
    "However, understanding how it works requires a change of mind.\n",
    "After a bit of practice it starts making sense.\n",
    "\n",
    "Here is how it works:\n",
    "\n",
    "+ Let's say that you have to learn some function $f(\\cdot)$ from some space $\\mathcal{X}$ to $\\mathbb{R}$ (this could either be a supervised learning problem (regression or classification) or even an unsupervised learning problem.\n",
    "\n",
    "+ You sit down and you think about $f(\\cdot)$. What do you know about it? How large do you expect it be? How small do you expect it be? Is it continuous? Is it differentiable? Is it periodic? How fast does it change as you change its inputs?\n",
    "\n",
    "+ You create a probability measure on the space of functions in which $f(\\cdot)$ lives which is compatible with everything you know about it. Abusing mathematical notation a lot, let's write this probability measure as $p(f(\\cdot))$. Now you can sample from it. Any sample you take is compatible with your prior beliefs. You cannot tell which one is better than any other. Any of them could be the true $f(\\cdot)$.\n",
    "\n",
    "+ Then, you get a little bit of data, say $\\mathcal{D}$. You model the likelihood of the data, $p(\\mathcal{D}|f(\\cdot))$, i.e., you model how the data may have been generated if you knew $f(\\cdot)$.\n",
    "\n",
    "+ Finally, you use Bayes' rule to come up with your posterior probability measure over the space of functions:\n",
    "$$\n",
    "p(f(\\cdot)|\\mathcal{D}) \\propto p(\\mathcal{D}|f(\\cdot)) p(f(\\cdot)),\n",
    "$$\n",
    "which is simultaneously compatible with your prior beliefs and the data.\n",
    "Again, we are abusing mathematical notation here sinc you cannot really write down the probability density corresponding to a random function.\n",
    "But you get the point.\n",
    "\n",
    "This is it.\n",
    "As Persi Diaconis' said in an 1988 paper:\n",
    "\n",
    "> Most people, even Bayesians, think that this sounds crazy when they first hear about it.\n",
    "\n",
    "Where do Gaussian processes come in?\n",
    "Well, it is just the equivalent of the multivariate Gaussian for function spaces.\n",
    "It defines a probability measure on the space of functions that is centered about a mean (function) and shaped by a covariance (function).\n",
    "In this lecture, we will show that the mean function and the covariance function is the place where you can encode your prior knowledge.\n",
    "We will also show how you can sample functions from this probability measure.\n",
    "Next time, we will show how you can condition these probability measures on observations."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Some mathematical terminology\n",
    "\n",
    "A *stochatic process* is just a collection of random variables that are labeled by some index: $\\{X_i\\}$ for some $i$ in a set $I$.\n",
    "If the set $I$ is discrete, then we say that we have a discrete stochastic process.\n",
    "If the set $I$ is continuous, then we have a continuous stochastic process.\n",
    "We will mostly work with continuous stochastic processes in this class.\n",
    "\n",
    "For example, $X_t = X(t)$ is a stochastic process parameterized by time.\n",
    "You can also think of a stochastic process as a random function.\n",
    "Here is how, you sample an $\\omega$, you keep it fixed, and then $X(t,\\omega)$ is just a function of time. (Remember what we learned in earlier lectures: a random variable is just a function from the event space to the real numbers).\n",
    "\n",
    "Of course, you can have a stochastic process that is parameterized by space, for example $T(x,\\omega)$, could be an unknown temperature field.\n",
    "This is typically called a random field.\n",
    "You can also have a stochastic process that is parameterized by both space and time, say $T(x,t,\\omega)$.\n",
    "This is a unknown spatiotemporal temperature field.\n",
    "As a matter of fact, you can have a stochastic process parameterized by any continuous label you like.\n",
    "It does not have to be space or time.\n",
    "And also, you can have as many different labels as you like.\n",
    "\n",
    "Gaussian processes are the simplest continuous stochastic processes you can have."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Gaussian process\n",
    "\n",
    "A Gaussian process (GP) is a generalization of a multivariate Gaussian distribution to\n",
    "*infinite* dimensions.\n",
    "It essentially defines a probability measure on a function space.\n",
    "When we say that $f(\\cdot)$ is a GP, we mean that it is a random variable that is actually\n",
    "a function.\n",
    "Mathematically, we write:\n",
    "\\begin{equation}\n",
    "f(\\cdot) \\sim \\mbox{GP}\\left(m(\\cdot), k(\\cdot, \\cdot) \\right),\n",
    "\\end{equation}\n",
    "where \n",
    "$m:\\mathbb{R}^d \\rightarrow \\mathbb{R}$ is the *mean function* and \n",
    "$k:\\mathbb{R}^d \\times \\mathbb{R}^d \\rightarrow \\mathbb{R}$ is the *covariance function*.\n",
    "So, compared to a multivariate normal we have:\n",
    "\n",
    "+ A random function $f(\\cdot)$ instead of a random vector $\\mathbf{x}$.\n",
    "+ A mean function $m(\\cdot)$ instead of a mean vector $\\boldsymbol{\\mu}$.\n",
    "+ A covariance function $k(\\cdot,\\cdot)$ instead of a covariance matrix $\\mathbf{\\Sigma}$."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "But, what does this definition actually mean? Actually, it gets its meaning from the multivariate Gaussian distribution. Here is how: \n",
    "\n",
    "+ Let $\\mathbf{x}_{1:n}=\\{\\mathbf{x}_1,\\dots,\\mathbf{x}_n\\}$ be $n$ points in $\\mathbb{R}^d$.\n",
    "+ Let $\\mathbf{f}\\in\\mathbb{R}^n$ be the outputs of $f(\\cdot)$ on each one of the elements of $\\mathbf{x}_{1:n}$, i.e.,\n",
    "$$\n",
    "\\mathbf{f} =\n",
    "\\left(\n",
    "\\begin{array}{c}\n",
    "f(\\mathbf{x}_1)\\\\\n",
    "\\vdots\\\\\n",
    "f(\\mathbf{x}_n)\n",
    "\\end{array}\n",
    "\\right).\n",
    "$$\n",
    "+ The fact that $f(\\cdot)$ is a GP with mean and covariance function $m(\\cdot)$ and $k(\\cdot,\\cdot)$, respectively, *means* that the vector of outputs $\\mathbf{f}$ at\n",
    "the arbitrary inputs in $\\mathbf{X}$ is the following multivariate-normal:\n",
    "$$\n",
    "\\mathbf{f} | \\mathbf{x}_{1:n}, m(\\cdot), k(\\cdot, \\cdot) \\sim \\mathcal{N}\\left(\\mathbf{m}(\\mathbf{x}_{1:n}), \\mathbf{K}(\\mathbf{x}_{1:n}, \\mathbf{x}_{1:n}) \\right),\n",
    "$$\n",
    "with mean vector:\n",
    "$$\n",
    "\\mathbf{m}(\\mathbf{x}_{1:n}) =\n",
    "\\left(\n",
    "\\begin{array}{c}\n",
    "m(\\mathbf{x}_1)\\\\\n",
    "\\vdots\\\\\n",
    "m(\\mathbf{x}_n)\n",
    "\\end{array}\n",
    "\\right),\n",
    "$$\n",
    "and covariance matrix:\n",
    "$$\n",
    "\\mathbf{K}(\\mathbf{x}_{1:n},\\mathbf{x}_{1:n}) = \\left(\n",
    "\\begin{array}{ccc}\n",
    "k(\\mathbf{x}_1,\\mathbf{x}_1) & \\dots & k(\\mathbf{x}_1, \\mathbf{x}_n)\\\\\n",
    "\\vdots & \\ddots & \\vdots\\\\\n",
    "k(\\mathbf{x}_n, \\mathbf{x}_1) & \\dots & k(\\mathbf{x}_n, \\mathbf{x}_n)\n",
    "\\end{array}\n",
    "\\right).\n",
    "$$\n",
    "\n",
    "Now that we have defined a Gaussian process (GP), let us talk about we encode our prior beliefs into a GP. \n",
    "We do so through the mean and covariance functions. "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Interpretation of the mean function\n",
    "\n",
    "What is the meaning of $m(\\cdot)$?\n",
    "Well, it is quite easy to grasp.\n",
    "For any point $\\mathbf{x}\\in\\mathbb{R}^d$, $m(\\mathbf{x})$ should give us the value we believe is more probable for \n",
    "$f(\\mathbf{x})$.\n",
    "Mathematically, $m(\\mathbf{x})$ is nothing more than the expected value of the random variable $f(\\mathbf{x})$.\n",
    "That is:\n",
    "\\begin{equation}\n",
    "m(\\mathbf{x}) = \\mathbb{E}[f(\\mathbf{x})].\n",
    "\\end{equation}\n",
    "\n",
    "The mean function can be any arbitrary function. Essentially, it tracks generic trends in the response as the input is varied. In practice, we try and make a suitable choice for the mean function that is easy to work with. Such choices include: \n",
    "\n",
    "+ zero, i.e.,\n",
    "$$\n",
    "m(\\mathbf{x}) = 0.\n",
    "$$\n",
    "\n",
    "+ a constant, i.e.,\n",
    "$$\n",
    "m(\\mathbf{x}) = c,\n",
    "$$\n",
    "where $c$ is a parameter.\n",
    "\n",
    "+ linear, i.e.,\n",
    "$$\n",
    "m(\\mathbf{x}) = c_0 + \\sum_{i=1}^dc_ix_i,\n",
    "$$\n",
    "where $c_i, i=0,\\dots,d$ are parameters.\n",
    "\n",
    "+ using a set of $m$ basis functions (generalized linear model), i.e.,\n",
    "$$\n",
    "m(\\mathbf{x}) = \\sum_{i=1}^mc_i\\phi_i(\\mathbf{x}),\n",
    "$$\n",
    "where $c_i$ and $\\phi_i(\\cdot)$ are parameters and basis functions.\n",
    "\n",
    "+ generalized polynomial chaos (gPC), i.e., \n",
    "using a set of $d$ polynomial basis functions upto a given degree $\\rho$\n",
    "$m(\\mathbf{x}) = \\sum_{i=1}^{d}c_i\\phi_i(\\mathbf{x})$ \n",
    "where the basis functions $\\phi_i$ are mutually orthonormal with respect to some \n",
    "measure $\\mu$:\n",
    "$$\n",
    "\\int \\phi_{i}(\\mathbf{x}) \\phi_{j}(\\mathbf{x}) d\\mu(\\mathbf{x}) = \\delta_{ij}\n",
    "$$\n",
    "\n",
    "+ and many other possibilities. "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Interpretation of the covariance function\n",
    "\n",
    "What is the meaning of $k(\\cdot, \\cdot)$?\n",
    "This concept is considerably more challenging than the mean.\n",
    "\n",
    "Let's try to break it down:\n",
    "\n",
    "+ Let $\\mathbf{x}\\in\\mathbb{R}^d$. Then $k(\\mathbf{x}, \\mathbf{x})$ is the variance of the random variable $f(\\mathbf{x})$, i.e.,\n",
    "$$\n",
    "\\mathbb{V}[f(\\mathbf{x})] = \\mathbb{E}\\left[\\left(f(\\mathbf{x}) - m(\\mathbf{x}) \\right)^2 \\right].\n",
    "$$\n",
    "In other words, we believe that there is about $95\\%$ probability that the value of\n",
    "the random variable $f(\\mathbf{x})$ fall within the interval:\n",
    "$$\n",
    "\\left((m(\\mathbf{x}) - 2\\sqrt{k(\\mathbf{x}, \\mathbf{x})}, m(\\mathbf{x}) + 2\\sqrt{k(\\mathbf{x},\\mathbf{x})}\\right).\n",
    "$$\n",
    "\n",
    "+ Let $\\mathbf{x},\\mathbf{x}'\\mathbb{R}^d$. Then $k(\\mathbf{x}, \\mathbf{x}')$ tells us how the random variable $f(\\mathbf{x})$ and\n",
    "$f(\\mathbf{x}')$ are correlated. In particular, $k(\\mathbf{x},\\mathbf{x}')$ is equal to the covariance\n",
    "of the random variables $f(\\mathbf{x})$ and $f(\\mathbf{x}')$, i.e.,\n",
    "$$\n",
    "k(\\mathbf{x}, \\mathbf{x}') = \\mathbb{C}[f(\\mathbf{x}), f(\\mathbf{x}')]\n",
    "= \\mathbb{E}\\left[\n",
    "\\left(f(\\mathbf{x}) - m(\\mathbf{x})\\right)\n",
    "\\left(f(\\mathbf{x}') - m(\\mathbf{x}')\\right)\n",
    "\\right].\n",
    "$$\n",
    "\n",
    "Essentially, a covariance function (or covariance kernel) defines a nearness or similarity measure on the input space. We cannot choose any arbitrary function of two variables as a covariance kernel. How we go about choosing a covariance function is discussed in great detail [here](http://www.gaussianprocess.org/gpml/chapters/RW4.pdf). We briefly discuss some properties of covariance functions here and then we shall move onto a discussion of what kind of prior beliefs we can encode through the covariance function. "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Properties of the covariance function\n",
    "\n",
    "+ There is one property of the covariance function that we can note right away.\n",
    "Namely, that for any $\\mathbf{x}\\in\\mathbb{R}^d$, $k(\\mathbf{x}, \\mathbf{x}) > 0$.\n",
    "This is easly understood by the interpretation of $k(\\mathbf{x}, \\mathbf{x})$ as the variance\n",
    "of the random variable $f(\\mathbf{x})$.\n",
    "\n",
    "+ $k(\\mathbf{x}, \\mathbf{x}')$ becomes smaller as the distance between $\\mathbf{x}$ and $\\mathbf{x}'$ grows.\n",
    "\n",
    "+ For any choice of points $\\mathbf{X}\\in\\mathbb{R}^{n\\times d}$, the covariance matrix: $\\mathbf{K}(\\mathbf{X}, \\mathbf{X})$ has\n",
    "to be positive-definite (so that the vector of outputs $\\mathbf{f}$ is indeed a multivariate\n",
    "normal distribution).\n",
    "\n",
    "\n",
    "### Encoding prior beliefs in the covariance function\n",
    "\n",
    "+ **Modeling regularity**. The choice of the covariance function controls the regularity properties of the functions sampled from the probability induced by the GP. For example, if the covariance kernel chosen is the squared exponential kernel, which is infinitely differentiable, then the functions sampled from the GP will also be infinitely differentiable. \n",
    "\n",
    "+ **Modeling invariance** If the covariance kernel is invariant w.r.t. a transformation $T$, i.e., $k(\\mathbf{x}, T\\mathbf{x}')=k(T\\mathbf{x}, \\mathbf{x}')=k(\\mathbf{x}, \\mathbf{x}')$ then samples from the GP will be invariant w.r.t. the same transformation. \n",
    "\n",
    "+ Other possibilities include periodicity, additivity etc. "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Squared exponential covariance function\n",
    "\n",
    "Squared expnential (SE) is the most commonly used covariance function.\n",
    "Its formula is as follows:\n",
    "$$\n",
    "k(\\mathbf{x}, \\mathbf{x}') = v\\exp\\left\\{-\\frac{1}{2}\\sum_{i=1}^d\\frac{(x_i - x_i')^2}{\\ell_i^2}\\right\\},\n",
    "$$\n",
    "where $v,\\ell_i>0, i=1,\\dots,d$ are parameters.\n",
    "The interpretation of the parameters is as follows:\n",
    "\n",
    "+ $v$ is known as the *signal strength*. The bigger it is, the more the GP $f(\\cdot)$ will vary\n",
    "about the mean.\n",
    "\n",
    "+ $\\ell_i$ is known as the *length scale* of the $i$-th input dimension of the GP.\n",
    "The bigger it is, the smoother the samples of $f(\\cdot)$ appear along the $i$-th input dimension.\n",
    "\n",
    "Let's experiment with this for a while:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "  \u001b[1mrbf.       \u001b[0;0m  |  value  |  constraints  |  priors\n",
      "  \u001b[1mvariance   \u001b[0;0m  |    1.0  |      +ve      |        \n",
      "  \u001b[1mlengthscale\u001b[0;0m  |    0.3  |      +ve      |        \n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZcAAAEHCAYAAABiAAtOAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAgAElEQVR4nO3deXRTdfo/8HfSLW26QDcobUnLIgqyCRRKQNFBoKAskZFFrY6o6KnjgFRKK7/vd0BHLCBYFgdBGUARmTJz2DQF+TKAig7DVh1WtUtCga60pKFbmvz+aG8htA1dktzb9v06xzP4udtTxubJ89muzGKxWEBERGRHcrEDICKi9ofJhYiI7I7JhYiI7I7JhYiI7I7JhYiI7M5V7ADE1rdvX5jNZnh7e4sdChFRm1FaWgq5XI7z5883eLzDVy5msxmcjU1E1DwWiwVms7nR4x2+chEqlpMnT4ocCRFR2zF06FCbxzt85UJERPYnmeRy4cIF9OvXD9evX7d5ntFoxJIlS6BWqzF48GC8/PLLyMrKck6QRETUJJJILhkZGZg7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F4fExET4+flhzJgxOHz4MLRaLVavXi12aE5VWFiIv/zlLwgNDcUzzzyD8+fPWx3v3r27pAe17U2Ygn2nTp062fwcEQuTC0nOgQMHAAA7d+7Ezp07rY65uLjU+4BpjzQaDSorK7F582akpqYiPDwcycnJmDhxotihOdW3336LsrIy5OTk4Jlnnql3fPny5ZgyZYoIkdG9yCzCaBAREZGddNw5jURE5DBMLkREZHdMLkREZHdMLkREZHdMLkREZHdMLkREZHdMLkQSUVRUhBEjRiAqKgoFBQUNnjNv3jz07dsX6enpTo6OqHmYXIgkwt/fH4sXL0ZJSQmWLl1a7/ju3buh1Wrx8ssvd4hdCqht4yJKIol57bXXcPjwYaxdu7bubZQ5OTmYPHkyunfvjr///e9wc3MTOUoi25hciCQmLy8PkyZNgoeHB77++mv4+PjgueeeQ3p6Ov75z392iLdxUtvHbjEiiQkODkZCQgLy8/OxcuVK7NixA//5z38wb948JhZqM1i5EEnUnDlzcPz4cSgUCvTt2xefffZZh34LJbUtTC5EEqXX6/H444/DYrFg9+7deOCBB8QOiajJ+DWISKL2799f9wrbzz//XORoiJqHlQuRBF28eBHTp09HVFQUqqqqcOLECWzevBlqtVrs0IiahMmFSGIqKyvx1FNPQa/XY8+ePTCZTJg6dSqCgoKwb98+KJVKsUMkuid2ixFJzJo1a3D58mXMmzcPKpUKPXv2xGuvvYacnBysXLlS7PCImoSVC5GEnD59Gs888wwGDRqE7du3180Oq6qqwlNPPYXLly9j27ZtiIqKEjlSItuYXIgkoqysDFOmTMH169exZ88eREZGWh3/+eefMWPGDISGhmLv3r3w9PQUKVKie2O3GJFELF++HNnZ2fjTn/5UL7EAQP/+/fH8889Dp9Nh9erVIkRI1HSsXIiIyO5YuRARkd0xuRARkd0xuRARkd0xuRARkd0xuRARkd0xuRARkd0xuRARkd0xuRARkd0xuRARkd0xuRARkd39f5CLAE2p1X/9AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "%matplotlib inline\n",
    "import seaborn as sns # Comment this out if you don't have it\n",
    "sns.set_style('white')\n",
    "sns.set_context('talk')\n",
    "import GPy\n",
    "# The input dimension\n",
    "dim = 1\n",
    "# The variance of the covariance kernel\n",
    "variance = 1.\n",
    "# The lengthscale of the covariance kernel\n",
    "ell = 0.3\n",
    "# Generate the covariance object\n",
    "k = GPy.kern.RBF(dim, variance=variance, lengthscale=ell)\n",
    "# Print it\n",
    "print (k)\n",
    "# and plot it\n",
    "k.plot();"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Example 1: Plotting a covariance function\n",
    "Remember:\n",
    "> The covariance function $k(x,x')$ measures the similarity of $f(x)$ and $f(x')$.\n",
    "\n",
    "The interactive tools provided, draw $k(\\mathbf{x}, \\mathbf{x}'=0)$ in one and two dimensions. \n",
    "Use them to answer the following questions:\n",
    "+ What is the intuitive meaning of $\\ell$?\n",
    "+ What is the intuitive meaning of $v$?\n",
    "+ There are many other covariance functions that we could be using. Try changing ``RBF`` to ``Exponential``. What changes do you nottice.\n",
    "+ Repeat the previous steps on a 2D covariance function.\n",
    "+ If you still have time, try a couple of other covariances, e.g., ``Matern32``, ``Matern52``.\n",
    "+ If you still have time, explore ``help(GPy.kern)``."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "7c3b3b2704174dcf9dc19f3f446264c6",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "interactive(children=(FloatSlider(value=1.0, description='variance', max=10.0, min=0.001, step=0.01), FloatSli…"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "from ipywidgets import interactive\n",
    "def plot_kernel(variance=1., ell=0.3):\n",
    "    k = GPy.kern.RBF(dim, variance=variance, lengthscale=ell)\n",
    "    k.plot()\n",
    "    plt.ylim(0, 10)\n",
    "interactive(plot_kernel, variance=(1e-3, 10., 0.01), ell=(1e-3, 10., 0.01))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "application/vnd.jupyter.widget-view+json": {
       "model_id": "1df005728c324b028a2f39ff4420051d",
       "version_major": 2,
       "version_minor": 0
      },
      "text/plain": [
       "interactive(children=(FloatSlider(value=1.0, description='variance', max=10.0, min=0.001, step=0.01), FloatSli…"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "from ipywidgets import interactive\n",
    "def plot_kernel(variance=1., ell1=0.3, ell2=0.3):\n",
    "    k = GPy.kern.RBF(2, ARD=True, variance=variance,\n",
    "                     lengthscale=[ell1, ell2])  # Notice that I just changed the dimension here\n",
    "    k.plot()\n",
    "interactive(plot_kernel, variance=(1e-3, 10., 0.01), ell1=(1e-3, 10., 0.01), ell2=(1e-3, 10., 0.01))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Example 2: Properties of the covariance matrix\n",
    "Let $\\mathbf{x}_{1:n}$ be an arbitrary set of input points. The covariance matrix $\\mathbf{K}\\in\\mathbb{R}^{n\\times n}$ defined by:\n",
    "$$\n",
    "\\mathbf{K}\\equiv\\mathbf{K}(\\mathbf{x}_{1:n}, \\mathbf{x}_{1:n}) = \\left(\n",
    "\\begin{array}{ccc}\n",
    "k(\\mathbf{x}_1,\\mathbf{x}_1) & \\dots & k(\\mathbf{x}_1, \\mathbf{x}_n)\\\\\n",
    "\\vdots & \\ddots & \\vdots\\\\\n",
    "k(\\mathbf{x}_n, \\mathbf{x}_1) & \\dots & k(\\mathbf{x}_n, \\mathbf{x}_n)\n",
    "\\end{array}\n",
    "\\right),\n",
    "$$\n",
    "must be [positive definite](https://en.wikipedia.org/wiki/Positive-definite_matrix). Mathematically this can be expressed in two equivalent ways:\n",
    "\n",
    "+ For all vectors $\\mathbf{v}\\in\\mathbb{R}^T$, we have:\n",
    "$$\n",
    "\\mathbf{v}^t\\mathbf{K}\\mathbf{v} > 0,\n",
    "$$\n",
    "+ All the eigenvalues of $\\mathbf{K}$ are positive."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Using the code provided:\n",
    "+ Verify that the the sum of two covariance functions is a valid covariance function.\n",
    "+ Verify that the product of two covariance functions is a valid covariance function.\n",
    "+ Is the following function a covariance function:\n",
    "$$\n",
    "k(x, x') = k_1(x, x')k_2(x, x') + k_3(x, x') + k_4(x, x'),\n",
    "$$\n",
    "where all $k_i(x, x')$'s are covariance functions.\n",
    "+ What about:\n",
    "$$\n",
    "k(x, x') = k_1(x, x') / k_2(x, x')?\n",
    "$$"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "> plotting eigenvalues of K\n",
      "> they must all be positive\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "Text(0, 0.5, '$\\\\lambda_i$')"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYkAAAEXCAYAAABYsbiOAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAXCklEQVR4nO3de1CU1/3H8Q+LIFRQwRSSCHihqVHrBUUzKtEkkhhy0YBTNWVMijpR66XxklgZatKp98ZLvI/By7TRjMNYGmvVJKY2P22mM4KXekFs1AixbWwkbQFBF3d/f1iIKzleuJ1d9/2a8Q/Ow9n9uvOwnz3nPM/ZALfb7RYAAN/CYbsAAID3IiQAAEaEBADAiJAAABgREgAAo2a2C2hIXbp0kcvlUlhYmO1SAMAnlJWVyeFw6OTJk996/J4aSbhcLnFFLwDcObfbLZfLZTx+T40kqkcQeXl5lisBAN+QmJh4y+P31EgCANCwCAkAgBEhAQAwIiQAAEaEBADAiJAAAB93sbRS+ee/1sXSygZ/7HvqElgA8De/PfSFMnOPKcjhkNPl0vzUbkrrFdNgj89IAgB81MXSSmXmHlOl06XSK1WqdLqUmXusQUcUhAQA+KjikgoFOTzfxoMcDhWXVDTYcxASAOCjYiND5bxpSw2ny6XYyNAGew5CAgB8VFR4iOandlNIkEPhzZspJMih+andFBUe0mDPwcI1APiwtF4xSnroPhWXVCg2MrRBA0IiJADA50WFhzR4OFRjugkAYERIAACMCAkAgBEhAQAwIiQAAEaEBADAiJAAABh5RUi89957SklJUc+ePfX8889rx44dtksCAMgLbqbbtm2b3nzzTY0ZM0aPPvqoPvnkE7322msKCgpSSkqK7fIAwK9ZD4nc3Fw98sgjmjVrliSpf//+On78uLZu3UpIAIBl1qebrly5ohYtWni0tW7dWv/+978tVQQAqGY9JF566SXt379fu3fvVllZmfbs2aM//elPGjZsmO3SAMDvWZ9uevbZZ/WXv/xFr776ak1bamqqxo0bZ7EqAIDkBSExceJEHT58WLNnz1aXLl109OhRrVmzRmFhYcrKyrJdHgD4NashcejQIR04cEALFixQWlqaJKlv375q2bKl5syZox/+8Ifq1KmTzRIBwK9ZXZP4+9//Lknq1auXR3tiYqIk6cyZM01eEwDgG1ZDokOHDpKkgwcPerQfOXJEktS2bdsmrwkA8A2r001du3ZVcnKy5s+fr/LycnXu3FnHjx/X6tWrNXDgQPXo0cNmeQDg96wvXC9btkyrVq3S5s2bdenSJbVt21ZjxozRK6+8Yrs0APB7AW632227iIZSvZaRl5dnuRIA8A23e9+0fjMdAMB7ERIAACNCAgBgREgAAIwICQCAESEBADAiJAAARoQEAMCIkAAAGBESAAAjQgIAYERIAACMCAkAgBEhAQAwIiQAAEaEBADAiJAAABgREgAAI0ICAGBESAAAjAgJAIARIQEAMCIkAABGhAQAwIiQAAAYERIAACNCAgBgREgAAIwICQCAESEBAD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ur8/lHSPixgIAAzZkzR++++65H+65duxQYGFhrgQy31rx5cyUmJurDDz/0WM/54IMPFB4erh/84AcWq/N+zZs316JFi7Rq1SqP9o8//liVlZW17pvwRzk5OVq4cKFSUlKUnZ1da3QwYMAA7du3r2bqSbp+/gUGBtb59WNNwo9FRkYqPT1dv/nNbxQWFqbExETl5+dr3bp1Sk9Pr7kqB3du4sSJysjI0LRp05SamqrDhw9rw4YNmjFjBpcZ30ZgYKAmTpyohQsXau7cuXriiSd0+vRprVy5UoMHD9Yjjzxiu0SrLl26pHnz5qlt27ZKT0/XyZMnPY7HxcVp3Lhx+sMf/qBXXnlFL7/8sj7//HMtXbpUI0aM0IMPPlin5yUk/NysWbMUHR2t7du3a/369YqOjtbUqVM1btw426X5pH79+mnlypVasWKFJk2apOjoaL3++usaM2aM7dJ8QkZGhsLCwvTrX/9aOTk5atWqlUaNGqUpU6bYLs26/fv3q6KiQhcuXFB6enqt44sXL9awYcO0ceNGLV68WFOnTlVERIQyMjLq9foFuLnOEQBgwJoEAMCIkAAAGBESAAAjQgIAYERIAACMCAkAgBEhAQAwIiSAJvLXv/5VnTp10uHDh22XAtwxbqYDmkhJSYmKiorUvXt3tg2HzyAkAABGfJwBmsjQoUM1e/Zs22UAd4WQAJrA1atXdfbsWXXu3Nl2KcBdISSAJvC3v/1NTqdTXbp0sV0KcFcICaAJnDx5UgEBAXr44YdtlwLcFUICaAIFBQWKi4ur+R5iwFcQEkATOHnyJOsR8EmEBNDIXC6XCgsLWY+ATyIkgEb2+eef6/Lly4wk4JMICaCRFRQUSBIhAZ/EHdcAACNGEgAAI0ICAGBESAAAjAgJAIARIQEAMCIkAABGhAQAwIiQAAAYERIAAKP/B2H0cPgUb2dbAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Number of dimensions\n",
    "dim = 1\n",
    "\n",
    "# Number of input points\n",
    "n = 20\n",
    "\n",
    "# The lengthscale\n",
    "ell = .1\n",
    "\n",
    "# The variance \n",
    "variance = 1.\n",
    "\n",
    "# The covariance function\n",
    "k1 = GPy.kern.RBF(dim, lengthscale=ell, variance=variance)\n",
    "\n",
    "# Draw a random set of inputs points in [0, 1]^dim\n",
    "X = np.random.rand(n, dim)\n",
    "\n",
    "# Evaluate the covariance matrix on these points\n",
    "K = k1.K(X)\n",
    "\n",
    "# Compute the eigenvalues of this matrix\n",
    "eig_val, eig_vec = np.linalg.eigh(K)\n",
    "\n",
    "# Plot the eigenvalues (they should all be positive)\n",
    "print ('> plotting eigenvalues of K')\n",
    "print ('> they must all be positive')\n",
    "fig, ax = plt.subplots()\n",
    "ax.plot(np.arange(1, n+1), eig_val, '.')\n",
    "ax.set_xlabel('$i$', fontsize=16)\n",
    "ax.set_ylabel('$\\lambda_i$', fontsize=16)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYgAAAEbCAYAAADAsRPLAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAgAElEQVR4nO3deXhTZfo38G+SNl3SfaOUllVZyzZipRQcF1yoWhEdEas4v2EUxYGBcQHBmUEHB0EUBPVFdgVURBFERJGRcUMHQUTZqkihZWlpS1uSLkmTnPeP5GRpszfJadPv57q82p5zcs4Dlty5n/tZZIIgCCAiImpGLnUDiIiobWKAICIihxggiIjIIQYIIiJyiAGCiIgcYoAgIiKHJA0QgiBg3bp1uOmmmzBo0CAUFBRg+/btUjaJiIjMwqR8+Ouvv46lS5di6tSpGDJkCL788ks8/vjjUCgUyM/P9+pe/fv3h9FoRExMTIBaS0QUejQaDeRyOY4ePdrinEyqiXJNTU3Iy8vDbbf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yZIlWLp0KWJjY4PYuuDy5O/CNkAIgoAXXngB69atw6RJkzB69OhgNFMy4k6+zfdJF4872wO4ozhw4AAefvhhZGZmYt68eVI3J6jEwSu///3vcdNNN0ndHJcYILygUqlQVFTk9LzBYMCECRNw8803Iy8vD3q93nLOaDRCr9cjLCw0/srd/V3Y0ul0mDVrFnbs2IFJkya5DCyhQvxw0DxTqKurszvfEX388ceYNWsWunfvjlWrViExMVHqJgXVxo0bUVRUhO3bt1veI8QPDnq9HgqFosUHC6mExrtVG3H+/HkcOnQIhw4dajHefdmyZVi2bJnHb6qhQqPRYPLkyfjhhx8we/ZsPPDAA1I3KSjE2kNJSQn69OljOX769Gm78x3N2rVrsWDBAuTk5ODVV1/tkIHy008/RXV1NUaOHNni3IABAzB//nyMGzdOgpa1xADhR2lpaXjvvfdaHL/rrrswYcIE3HnnnRK0SjoGgwGPPPIIDh06ZBny2VF069YNmZmZ+OSTT+wmQO3atQvdu3dHRkaGhK2TxubNm/H8888jPz8fCxYsgFKplLpJknjmmWcsmaTo1VdfxbFjx/DKK68gMzNTopa1xADhR0qlssWQTlFaWprTc6HqnXfewb59+zB+/Hh07twZP/74o+WcTCbD4MGDJWxd4D366KN46qmnEB8fj2uuuQaff/45du7cicWLF0vdtKCrqqrCc889hy5duqCwsBBHjx61O9+1a9c2Xaz1J3For62EhASX7x9SYYCggPn0008BAJs2bcKmTZvszikUihZvEqFm3Lhx0Ol0WLNmDTZv3oysrCwsWLAA+fn5Ujct6L766is0NDTg7NmzKCwsbHF+4cKFuP322yVoGbkiE8TqCBERkY2OPdaOiIicYoAgIiKHGCCIiMghBggiInKIAYKIiBxigCAiIocYIIj86OLFixg+fDhycnJQWVnp8Jrp06ejf//+OHToUJBbR+QdBggiP0pKSsLTTz+N2tpaPPvssy3Ob926FTt37sSDDz4Y8jPJqf3jRDmiAHjkkUfw+eefY9myZZZd5c6ePYuCggJ07doV7777LsLDwyVuJZFrDBBEAXDhwgXccsstiIiIwMcff4zY2Fjcf//9OHToELZs2RLyO+pRaGAXE1EApKWlYebMmaioqMCiRYvw9ttv4/vvv8f06dMZHKjdYAZBFECTJk3C3r17ERkZif79+2P9+vUdfjc5aj8YIIgCqLS0FDfccAMEQcDWrVvRr18/qZtE5DF+lCEKoI8++siyneSGDRskbg2Rd5hBEAXI8ePHcddddyEnJwdNTU3Yt28f1qxZg7y8PKmbRuQRBgiiANDpdLjzzjtRWlqKbdu2Qa/XY+zYsUhNTcX27duhUqmkbiKRW+xiIgqApUuX4pdffsH06dPRrVs39OrVC4888gjOnj2LRYsWSd08Io8wgyDysx9++AGFhYUYMmQINm7caBm11NTUhDvvvBO//PIL3nzzTeTk5EjcUiLXGCCI/KihoQG33347ysrKsG3bNvTo0cPu/M8//4zx48ejS5cu+PDDDxEVFSVRS4ncYxcTkR8tXLgQp0+fxl//+tcWwQEABg4ciAceeAAlJSVYvHixBC0k8hwzCCIicogZBBEROcQAQUREDjFAEBGRQwwQRETkEAMEERE5xABBREQOMUAQEZFDDBBEROQQAwQRETn0/wFcatGJLZaQPAAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Now create another (arbitrary) covariance function\n",
    "k2 = GPy.kern.Exponential(dim, lengthscale=0.2, variance=2.1)\n",
    "\n",
    "# Create a new covariance function that is the sum of these two:\n",
    "k_new = k1 + k2\n",
    "\n",
    "# Let's plot the new covariance\n",
    "fig, ax = plt.subplots()\n",
    "k1.plot(ax=ax, label='$k_1$')\n",
    "k2.plot(ax=ax, label='$k_2$')\n",
    "k_new.plot(ax=ax, label='$k_1 + k_2$')\n",
    "plt.legend(fontsize=16);"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "> plotting eigenvalues of K\n",
      "> they must all be positive\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgo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HTvWovUCAO7OshFJaGioVqxYUac9JydHkhQXF6fvvvtOsbGxPv3h4eEKDQ1VUVFRi9QJAKifre7a+uqrr5Sdna2RI0eqQ4cOkm4Fzp3at2/vsyAPALCObYIkLy9PM2bMUFRUlFatWiWv1ytJCggIqPNar9crh8M2pQNAm2aLq/HBgweVnp6uhx9+WDt37lRYWFjtSORuI49r167J5XK1dJkAgLuwPEh27NihRYsWqV+/ftq9e7ciIiIk3Zq+ioyMVHFxsc/rL1++rIqKijprJwAAa1gaJHv37tWaNWuUkpKirVu31hllDB48WJ9++qlu3LhR23b48GE5nU4NHDiwpcsFANyFZXdtXb58Wa+99pq6deumtLQ0nTx50qc/JiZGM2bM0CeffKKZM2dqypQpOn/+vNavX68JEyaoa9euFlUOALidZUHyxRdf6Pr16/r222+VlpZWpz8zM1MvvPCCtm/frszMTC1YsEBhYWFKT0/X/PnzLagYAHA3Ad6a26PaiKSkJElSbm6uxZUAgP+o79pp+WI7AMC/ESQAACMECQDACEECADBCkAAAjBAkAAAjBAkAwAhBAgAwQpAAAIwQJAAAIwQJAMAIQQIAMEKQAACMECQAACMECQDACEECADBCkAAAjBAkAAAjBAkAwAhBAgAwQpAAAIwQJAAAIwQJAMAIQQIAMEKQAACMECQAACMECQDASKODZMqUKZKkzZs367PPPtOlS5earCgAgP94qLEHbtq0SZJUXV2t9957T19//bUcDod69uypnj17at68eU1WJADAvhodJB06dJAkLViwoLbt+++/19/+9jd9/fXX5pUBAPxCo4PkbiIjIxUZGakRI0Y05a8FANgYi+0AACNGI5KbN2/q3LlzOn36tE6dOqXTp0/rnXfeaaraAAB+4L6DpKysTKdPn/YJjbNnz8rtdsvr9SooKEg/+tGPmrNWAIANNRgk+/btU1ZWli5evFjbFhISoj59+igtLU2PPfaYHn/8ccXFxcnpdDZrsQAA+2kwSNatW6cOHTpo8eLFio2N1Y4dO/SXv/xFAwYM0OzZswkPAGjjGgySsrIyrVu3ToMGDZIkjRgxQrt379a6det09OhRrVmzhiktAGjDGrx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CrCjLb8XExMjpdKqkpMSnvebnO+eu4evatWvat29fncDwer1yu92cj/+zY8cOLVq0SP369dPu3bsVEREh6db0VWRkpIqLi31ef/nyZVVUVDT6/CNIUK+AgACtXLlSu3bt8mk/ePCgnE5nnUU91K9du3ZKSkrSkSNHfNaXDh8+LJfLpV69ellYnf21a9dOb7zxhn7zm9/4tB89elSVlZV19pW0RXv37tWaNWuUkpKirVu31hllDB48WJ9++mntNJd06/xzOp2N/vxYI0G9wsPDlZaWpnfffVehoaFKSkpSXl6etmzZorS0tNq7jXD/5syZo/T0dGVkZCg1NVUnTpzQtm3btHjxYm6xboDT6dScOXO0Zs0arVq1SsOHD9c333yjTZs2acSIEfrxj39sdYmWunz5sl577TV169ZNaWlpOnnypE9/TEyMZsyYoU8++UQzZ87UlClTdP78ea1fv14TJkxQ165dG/W+BAkatHTpUkVGRmrfvn3Kzs5WZGSkFixYoBkzZlhdml8aNGiQNm3apKysLM2dO1eRkZF65ZVXNG3aNKtL8wvp6ekKDQ3Vb3/7W+3du1cdO3bUpEmTNH/+fKtLs9wXX3yh69ev69tvv1VaWlqd/szMTL3wwgvavn27MjMztWDBAoWFhSk9Pd3o8wvwcv8mAMAAayQAACMECQDACEECADBCkAAAjBAkAAAjBAkAwAhBAgAwQpAANvLXv/5V8fHxOnHihNWlAPeNDYmAjZSVlamkpER9+vThkfLwGwQJAMAIX3kAGxk7dqyWLVtmdRnAAyFIAJu4ceOGzp07p8cff9zqUoAHQpAANvH3v/9dbrdbCQkJVpcCPBCCBLCJkydPKiAgQI899pjVpQAPhCABbKKwsFAxMTG1f1cb8BcECWATJ0+eZH0EfokgAWzA4/Ho9OnTrI/ALxEkgA2cP39e165dY0QCv0SQADZQWFgoSQQJ/BI72wEARhiRAACMECQAACMECQDACEECADBCkAAAjBAkAAAjBAkAwAhBAgAwQpAAAIz8f2W5FlUUiJffAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# If this is a valid covariance function, then it must \n",
    "# be positive definite\n",
    "# Compute the covariance matrix:\n",
    "K_new = k_new.K(X)\n",
    "\n",
    "# and its eigenvalues\n",
    "eig_val_new, eig_vec_new = np.linalg.eigh(K_new)\n",
    "\n",
    "# Plot the eigenvalues (they should all be positive)\n",
    "print ('> plotting eigenvalues of K')\n",
    "print ('> they must all be positive')\n",
    "fig, ax = plt.subplots()\n",
    "ax.plot(np.arange(1, n+1), eig_val_new, '.')\n",
    "ax.set_xlabel('$i$', fontsize=16)\n",
    "ax.set_ylabel('$\\lambda_i$', fontsize=16);"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Example 3: Sampling from a Gaussian process\n",
    "\n",
    "Samples from a Gaussian process are functions. But, functions are infinite dimensional objects?\n",
    "We cannot sample directly from a GP....\n",
    "However, if we are interested in the values of $f(\\cdot)$ at any given set of test points $\\mathbf{x}_{1:n} = \\{\\mathbf{x}_1,\\dots,\\mathbf{x}_b\\}$, then we have that:\n",
    "$$\n",
    "\\mathbf{f} | \\mathbf{x}_{1:n} \\sim \\mathcal{N}\\left(\\mathbf{m}(\\mathbf{x}_{1:n}), \\mathbf{K}(\\mathbf{x}_{1:n}, \\mathbf{x}_{1:n}) \\right),\n",
    "$$\n",
    "where all the quantities have been introduced above.\n",
    "This is\n",
    "What we are going to do is pick a dense set of points $\\mathbf{x}_{1:n}\\in\\mathbb{R}^{n\\times d}$\n",
    "sample the value of the GP, $\\mathbf{f} = (f(\\mathbf{x}_1),\\dots,f(\\mathbf{x}_n))$ on these points.\n",
    "We saw above that the probability density of $\\mathbf{f}$ is just a multivariate normal\n",
    "with a mean vector that is specified from the mean function and a covariance matrix\n",
    "that is specified by the covariance function.\n",
    "Therefore, all we need to know is how to sample from the multivariate normal.\n",
    "This is how we do it:\n",
    "+ Compute the Cholesky of $\\mathbf{L}$:\n",
    "$$\n",
    "\\mathbf{K} = \\mathbf{L}\\mathbf{L}^T.\n",
    "$$\n",
    "+ Draw $n$ random samples $\\mathbf{z} = (z_1,\\dots,z_n)$ independently from a standard normal.\n",
    "+ Get one sample by:\n",
    "$$\n",
    "\\mathbf{f} = \\mathbf{m} + \\mathbf{L}\\mathbf{z}.\n",
    "$$"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZAAAAEWCAYAAABIVsEJAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAgAElEQVR4nO3de3yO9f8H8Nc2LWwOOeUw5pA5i+Y8x8xhTiFCUgmpKOkgCfHTQUKSU+VUX8ecKmZO5ZQzZTmMMLZhmA2zse0+fH5/vDc2xnZfu+/7um57PR+PPdR9/FzbfV+v63N2U0opEBER2chd7wIQEZFrYoAQEZEmDBAiItKEAUJERJowQIiISJM8ehfAWapXrw6r1Qpvb2+9i0JE5BISEhLg7u6O48ePZ3p/rqmBWK1WcMQyEVH2KaVgtVofeH+uqYGk1TwOHjyoc0mIiFxDvXr1Hnp/rqmBEBGRfTFAiIhIEwYIERFpwgAhIiJNGCBERKQJA4SIiDRhgBARkSYMECIi0oQBQkREmjBAiIhIEwYIERFpwgAhIiJNGCBERKQJA4SIiDRxmQAZOnQo2rRpo3cxiIgolUsEyG+//YbNmzfrXQwiIkrH8AFy+fJlfP755yhZsqTeRSEionQMHyCjR49GQEAAGjdurHdRiIgoHUMHyIoVK3Ds2DGMGTNG76IQEdE9DLsn+oULF/Dll1/iyy+/RJEiRfQuDhER3cOQNRClFEaNGoUWLVqgXbt2eheHiIgyYcgayOLFi3Hy5EmsXbsWZrMZgIQKAJjNZnh4eMDNzU3PIhIR5XqGDJCNGzfi2rVraNq06X331ahRA19++SW6d++uQ8mIiCiNIQNk/PjxSExMzHDbzJkzERYWhhkzZsDHx0enkhERURpDBkjFihXvu61w4cLw9PRErVq1dCgRERHdy5Cd6EREZHyGrIFkZuLEiXoXgYiI0mENhIiINGGAEBGRJgwQIiLShAFCRESaMECIiEgTBggREWnCACEiIk0YIEREpAkDhIiINGGAEBGRJgwQIiLShAFCRESaMECIiEgTBggREWnCACEiIk0YIEREpAkDhIiINGGAEBGRJgwQIiLShAFCRESaMECIiEgTBggREWnCACEiIk0YIEREpAkDhIiINGGAEBGRJgwQIiLShAFCRESaMECIiEgTBggREWmSR+8CPIjVasXy5cuxZMkSnD9/HkWLFkXr1q3x9ttvw9vbW+/iERHleoYNkLlz52LatGkYMGAAGjdujLNnz2L69Ok4ffo05s2bp3fxiIhyPUMGiFIKc+fORa9evfD+++8DAJo0aYInnngCw4cPR1hYGKpVq6ZzKYmIcjdD9oEkJiaiS5cu6NSpU4bbK1asCACIjIzUo1hERJSOIWsg3t7eGD169H23b9myBQDw1FNPObtIRER0D0PWQDITGhqKH374AYGBgahUqZLexSEiyvVcIkAOHTqEgQMHwsfHB5999pnexSEiIrhAgKxfvx79+/dHqVKlsHDhQjzxxBN6F4mIiGDwAFmwYAHee+891KlTB4sXL0aJEiX0LhIREaUybICsWLECEydORFBQEObOnYsCBQroXSQiIkrHkKOwYmNj8fnnn6NMmTLo27cvjh8/nuH+cuXKoUiRIjqVjoiIAIMGyM6dO3H79m1cuHABffv2ve/+SZMm4bnnntOhZERElMaQAdK1a1d07dpV72IQEdFDGLYPhIiIjI0BQkREmjBAiIhIEwYIERFpwgAhIiJNGCBERKQJA4SIiDRhgBARkSYMECIi0oQBQkREmjBAyDZJN4DzhwCl9C4JEenMkGthkcGkJAL/bQCOrgbO7gA8vYCKrYCOUwDP/HqXjoh0whoIZc6UBIStA1b0B6ZUAw4vAap0AN49Agw9CFhNwLw2QOwZvUtKRDphDYTuspiAM1uBY6uBk+uBkrWBms8DHSYDXkUzPrb7j8DBeRIinaYB1b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4+LFixg1ahSUUvjiiy+QN29evQ8pS7Ye89KlS7FkyRL07NkTDRo0wKVLl+78XL58GSVLltT7kLJkyzHny5cPTz755H0/M2bMQOvWrdGpUye9DydbbP07ly1bFkeOHMGyZcvg5eWF+Ph4TJo0CUePHsWkSZNQokQJvQ8pS7Yec8WKFbFixQps374dhQsXxoULFzB9+nRs3boVY8eOdYlRhumFhYXhjz/+QP/+/e80Rzn0HGbTrJFH1NKlS1WbNm1UzZo1VVBQUIZJRatWrVJ+fn5q7969d267fv26GjlypKpXr5565pln1KBBg9SZM2f0KLpmthxzv379lJ+fX6Y/1apV0+sQbGbr3/lerjaRUCnbj/n27dtq4sSJqmnTpqpWrVqqV69eat++fXoUXTNbj/n06dNq8ODBqm7dusrf31/16dNH7dq1S4+i51ja8aWfSOjIc5ibUg/pkiciInqAXN0HQkRE2jFAiIhIEwYIERFpwgAhIiJNGCBERKQJA4SIiDRhgBARkSYMECIi0oQBQkREmjBAiHQQERGBGjVqYPr06Rlu//TTT1G3bl0cOXJEp5IRZR8DhEgHvr6+6NGjBxYuXIi4uDgAwIwZM7Bq1SrMnDnzvv3niYyIa2ER6SQmJgZt2rRBnz59ULFiRYwdOxZTpky5s7UqkdHl6i1tifRUvHhxvPLKK5g/fz4sFgtGjx7N8CCXwiYsIh35+voiJSUFderUQd++ffUuDpFNGCBEOtmzZw/Gjh2LunXr4u+//8aJEyf0LhKRTRggRDo4duwYhgwZgp49e+Lnn39G6dKlMXXqVL2LRWQTBgiRk0VERGDQoEFo2rQpxowZA09PTwwZMgTbt2/HgQMH9C4eUbZxFBaRE8XExKB3794oXbo05s2bB09PTwCAxWJBp06dUKhQISxbtkznUhJlDwOEiIg0YRMWERFpwgAhIiJNGCBERKQJA4SIiDRhgBARkSYMECIi0oQBQkREmjBAiIhIEwYIERFp8v+EqlLL3muJ4gAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# To gaurantee reproducibility\n",
    "np.random.seed(123456)\n",
    "\n",
    "# Number of test points\n",
    "num_test = 10\n",
    "\n",
    "# Pick a covariance function\n",
    "k = GPy.kern.RBF(input_dim=1, variance=1., lengthscale=.1)\n",
    "\n",
    "# Pick a mean function\n",
    "mean_func = lambda x: np.zeros(x.shape)\n",
    "\n",
    "# Pick a bunch of points over which you want to sample the GP\n",
    "X = np.linspace(0, 1, num_test)[:, None]\n",
    "\n",
    "# Evaluate the mean function at X\n",
    "m = mean_func(X)\n",
    "\n",
    "# Compute the covariance function at these points\n",
    "nugget = 1e-6 # This is a small number required for stability\n",
    "C = k.K(X) + nugget * np.eye(X.shape[0])\n",
    "\n",
    "# Compute the Cholesky of the covariance\n",
    "# Notice that we need to do this only once\n",
    "L = np.linalg.cholesky(C)\n",
    "\n",
    "# Number of samples to take\n",
    "num_samples = 3\n",
    "\n",
    "# Take 3 samples from the GP and plot them:\n",
    "fig, ax = plt.subplots()\n",
    "# Plot the mean function\n",
    "ax.plot(X, m)\n",
    "for i in range(num_samples):\n",
    "    z = np.random.randn(X.shape[0], 1)    # Draw from standard normal\n",
    "    f = m + np.dot(L, z)                  # f = m + L * z\n",
    "    ax.plot(X, f, color=sns.color_palette()[1], linewidth=1)\n",
    "#ax.set_ylim(-6., 6.)\n",
    "ax.set_xlabel('$x$', fontsize=16)\n",
    "ax.set_ylabel('$y$', fontsize=16)\n",
    "ax.set_ylim(-5, 5);"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The solid line is the mean function and the dashed lines are 3 samples of   f . These don’t look like functions yet. This is because we have used only 10 test points to represent the GP."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Questions\n",
    "\n",
    "1. Edit the code above changing the number of test points ``num_test`` to 20, 50, 100. Rerun the example. How do your samples of   f look like now? Do they look more like functions to you? Imagine that the true nature of the GP appears when these test points become infinitely dense.\n",
    "\n",
    "2. Edit the code above and change the random seed to an arbitrary integer (just make up one). Rerun the example and notice how the sampled functions change.\n",
    "\n",
    "3. Edit the code above and change the variance first to 0.1 and then to 5 each time rerunning the example. Notice the values on the vertical axis of the plot. What happens to the sampled functions as you do this? What does the variance parameter of the SE control?\n",
    "\n",
    "4. Edit the code above and now change the length-scale parameter first to 0.05 and then to 1. What happens to the sampled functions as you do this? What does the length- scale parameter of the SE control?\n",
    "\n",
    "5. Now set the variance and the length-scale back to their original values (1. and 0.1, respectively). Edit the code and change the mean function to:\n",
    "```\n",
    "     mean_fun = lambda(x): 5 * x\n",
    "```\n",
    "Re-run the example. What do you observe? Try a couple more. For example, try:\n",
    "```\n",
    "     mean_fun = lambda(x): np.sin(5 * np.pi * x)\n",
    "```\n",
    "\n",
    "6. So far, all the samples we have seen are smooth. There is this theorem that says that the samples of the GP will be as smooth as the covariance function we use. Since the SE covariance is infinitely smooth, the samples we draw are infinitely smooth. The [Matern 3-2 covariance function](https://en.wikipedia.org/wiki/Matérn_covariance_function) is twice differentiable. Edit the code and\n",
    "change ``RBF`` to ``Matern32``. Rerun the example. How smooth are the samples now?\n",
    "\n",
    "7. The exponential covariance function is continuous but not differentiable. Edit the code and change ``RBF`` to ``Exponential``. Rerun the example. How smooth are the samples now?\n",
    "\n",
    "8. The covariance function can also be used to model invariances. The periodic exponential covariance function is... a periodic covariance function. Edit line 29 and change ``RBF`` to \n",
    "```\n",
    "k = GPy.kern.PeriodicMatern32(input_dim=1, variance=500., lengthscale=0.01, period=0.1)\n",
    "```\n",
    "Rerun the example. Do you notice the periodic pattern?\n",
    "\n",
    "9. How can you encode the information that there are two lengthscales in $f(\\cdot)$. There are many ways to do this.\n",
    "Try summing or multiplying covariance functions."
   ]
  }
 ],
 "metadata": {
  "anaconda-cloud": {},
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.7"
  },
  "latex_envs": {
   "bibliofile": "biblio.bib",
   "cite_by": "apalike",
   "current_citInitial": 1,
   "eqLabelWithNumbers": true,
   "eqNumInitial": 0
  },
  "widgets": {
   "state": {
    "9d75ca2df1164d908aba9f67229246d2": {
     "views": [
      {
       "cell_index": 14
      }
     ]
    },
    "abdf17dbd32e43eea86365f2f2a8bd34": {
     "views": [
      {
       "cell_index": 13
      }
     ]
    }
   },
   "version": "1.2.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
